// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.lang;

import java.util.ArrayList;
import java.util.List;

public abstract class ListUtils {

	public static <T> List<T> emptyListIfNull(List<T> nullableList) {

		List<T> result;

		if (nullableList == null) {
			result = new ArrayList<T>();
		}
		else {
			result = nullableList;
		}
		
		return result;
	}

	public static <T> T firstItem(List<T> list) {
		if(list == null || list.isEmpty()) {
			return null;
		}
		return list.get(0);
	}

}
